package org.agile2soft.nexoma.core.dao.hibernate;

import org.agile2soft.nexoma.core.dao.ProfileDAO;
import org.agile2soft.nexoma.core.entity.Profile;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;

import br.com.arsmachina.dao.hibernate.GenericDAOImpl;

public class ProfileDAOImpl extends GenericDAOImpl <Profile,Integer> implements ProfileDAO {

    public ProfileDAOImpl(SessionFactory sessionFactory) {
        super(sessionFactory);
    }

	public Profile findByName(String name) {
		return (Profile)getSession().createCriteria(Profile.class)
                                    .add(Restrictions.eq("name", name))
                                    .uniqueResult();
	}

}
